import Vue from 'vue'
import App from './App.vue'

import router from './router'

// 引入全局session工具类
import session from './util/session'
Vue.prototype.$session = session

import moment from 'moment'
Vue.prototype.$moment = moment

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

// 重写原生alert方法（不显示IP）
window.alert = function(name){
  let iframe = document.createElement("IFRAME");
  iframe.style.display="none";
  document.documentElement.appendChild(iframe);
  window.frames[0].window.alert(name);
  iframe.parentNode.removeChild(iframe)
}

// 重写原生confirm方法（不显示IP）
window.confirm = function (message) {
  let iframe = document.createElement("IFRAME");
  iframe.style.display = "none";
  iframe.setAttribute("src", 'data:text/plain,');
  document.documentElement.appendChild(iframe);
  var alertFrame = window.frames[0];
  var result = alertFrame.window.confirm(message);
  iframe.parentNode.removeChild(iframe);
  return result;
}

Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App),
  beforeCreate() {
    // 定义全局事件总线
    Vue.prototype.$bus = this
  }
}).$mount('#app')
